package game.sev;

import game.bean.PlayerInfo;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

/**
 * @author liuyulai
 * 玩家信息处理层
 */
public class PlayerInfoSev {

    public static List<PlayerInfo> list = new ArrayList<PlayerInfo>();


    public static void addNewPlayInfo(PlayerInfo p) {
        list.add(p);
        //先进行比较排序
        list.sort((o1, o2) -> {
            if (o1.getNum() == o2.getNum()) {
                return o1.getName().compareTo(o2.getName());
            }
            return o2.getNum() - o1.getNum();
        });
    }
}
